package com.limanyik.family.oss.controller;

import com.limanyik.family.common.entity.server.base.dto.MobilePhoneMessageDto;
import com.limanyik.family.common.entity.server.base.vo.MobilePhoneMessageVo;
import com.limanyik.family.common.utils.FamilyHttpRequest;
import com.limanyik.family.common.utils.FamilyHttpResponse;
import com.limanyik.family.oss.message.service.MessageService;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
public class MessageController {

    @Resource(name = "aliyunMessageServiceImpl")
    MessageService aliMessageService;

    @PostMapping("/message/test")
    public FamilyHttpResponse testMessage() {
        return FamilyHttpResponse.success(aliMessageService.verificationCode(new MobilePhoneMessageVo().setMessage("145621").setPhone("17608445417")));
    }

    @PostMapping("/message/sendMessage")
    public FamilyHttpResponse<MobilePhoneMessageDto> sendMessage(@RequestBody FamilyHttpRequest<MobilePhoneMessageVo> requestVo) {
         return FamilyHttpResponse.success(aliMessageService.verificationCode(requestVo.getData()));
    }


}
